package com.base.cn.platform.os.controller.manage.area;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.entity.manage.area.SysArea;
import com.base.cn.platform.os.service.manage.area.SysAreaBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 地址Controller
 *
 * @author ll
 * @create 2018-05-11-18:33
 */
@RestController
@RequestMapping("/manage")
public class SysAreaController extends BaseController {

    @Autowired
    private SysAreaBiz sysAreaBiz;


    /**
     * 根据Ids 搜索地址
     * @param areaIds
     * @return List<SysArea>
     */
    @RequestMapping("/querySysAreaListByIds")
    public List<SysArea> querySysAreaListByIds(@RequestParam("areaIds")String areaIds){
        return sysAreaBiz.querySysAreaListByIds(areaIds);
    }


    /**
     * 根据Ids 搜索地址
     * @param areaIds
     * @return Map<BigDecimal,SysArea>
     */
    @RequestMapping("/querySysAreaMapByIds")
    public Map<BigDecimal,SysArea> querySysAreaMapByIds(@RequestParam("areaIds")String areaIds){
        return sysAreaBiz.querySysAreaMapByIds(areaIds);
    }


    /**
     * 搜索地址
     * @param sysArea
     * @return Map<BigDecimal,SysArea>
     */
    @RequestMapping("/queryUserAreaList")
    public List<SysArea> queryUserAreaList(@RequestBody SysArea sysArea){
        return sysAreaBiz.queryUserAreaList(sysArea);
    }


    /**
     * 根据Ids 搜索地址
     * @param parentId
     * @return Map<BigDecimal,SysArea>
     */
    @RequestMapping("/querySysAreaMapByParentId")
    public Map<BigDecimal,SysArea> querySysAreaMapByParentId(@RequestParam("parentId")BigDecimal parentId){
        return sysAreaBiz.querySysAreaMapByParentId(parentId);
    }

    /**
     * 通过父级id串，查询地区列表
     * @param parentIds 父级id串
     * @return
     */
    @RequestMapping("/querySysAreaMapByParentIds")
    public Map<BigDecimal,List<SysArea>> querySysAreaMapByParentIds(@RequestParam("parentIds") String parentIds){
        return sysAreaBiz.querySysAreaMapByParentIds(parentIds);
    }

    /**
     * 通过父级id串，查询地区列表
     * @return
     */
        @RequestMapping("/queryFullAddress")
    public SysArea  queryFullAddress(@RequestParam("areaType") Integer areaType,@RequestParam("name") String name){
        return sysAreaBiz.queryFullAddress(areaType,name);
    }


}
